<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0,minimum-scale=1.0, maximum-scale=1.0,user-scalable=no">
		<title>供应商系统</title>
		<link rel="stylesheet" type="text/css" href="/Public/css/bootstrap.css"/>
		<link rel="stylesheet" href="/Public/css/style.css" />
		<link rel="stylesheet" type="text/css" href="/Public/css/font-awesome.min.css"/>
		<link rel="stylesheet" type="text/css" href="/Public/css/user.css"/>
	</head>
	<body>
		<header class="header">
			<h1>上门宝超市-供应商中心</h1>
		</header>
		<div id="app">
			<section class="info">
				<h2>{{name}}</h2>
				<p>{{address}}</p>
				<ul>
					<li v-for="tag in tags">{{tag}}</li>
				</ul>
			</section>
			<section class="infobox">
				<h3 class="hidden">信息列表</h3>
				<div class="info-list">
					<ul>
						<li><a href="/index/information?0">合作信息<i class="fa fa-angle-right"></i></a></li>
						<li><a href="/index/information?1">资质信息<i class="fa fa-angle-right"></i></a></li>
						<li><a href="/index/information?2">账户信息<i class="fa fa-angle-right"></i></a></li>
					</ul>
				</div>
				<div class="info-list">
					<ul>
						<li><a href="/index/information?3">供应商联系信息<i class="fa fa-angle-right"></i></a></li>
						<li><a href="/index/information?4">服务中心<i class="fa fa-angle-right"></i></a></li>
						<li><a href="/index/information?5">意见反馈<i class="fa fa-angle-right"></i></a></li>
					</ul>
				</div>
            </section>
                <div class="exit">
                    <button type="button" @click="sign_out()">退出登录</button>
                </div>
			<footer class="footer">
				<ul>
					<li><a href="/"><i class="fa fa-home"></i>首页</a></li>
					<li><a href="/index/user"><i class="fa fa-user"></i>个人</a></li>
				</ul>
			</footer>
		</div>
		<script src="/Public/js/jquery-2.1.0.js"></script>
		<script src="/Public/js/vue.js"></script>
		<script src="/Public/js/vue-resource.js"></script>
		<script>
			var vm = new Vue({
				el:"#app",
				data:{
					name:"",		//供应商名称
					address:"",		//供应商名称地址
					tags:[]			///供应商标签
				},
				created:function(){		
					    this.$http.get('/supinfo/supplier_info',{emulateJSON: true}).then(function (res) {		//初始化数据
                             console.log(res.data);
                             this.name = res.data.data.supplier_name;
			                 this.address = res.data.data.address;
			                 this.tags = res.data.data.Category;
			              },function (res) {
								this.error(res);
			              });
				},
				methods:{
                    sign_out:function(){
                        this.$http.get('/login/cancel',{emulateJSON: true}).then(function (res) {		//退出登录
                            if(res.data = "200"){
                                window.location.reload();
                            }
                        },function (res) {
                            this.error(res);
                        });
                    },
					error:function(res){	//错误抛出
						console.error("错误类型:"+res.status,"错误描述:"+res.statusText);
					}
				},
				mounted:function(){			//导航添加active
					$.each($('.footer').find('a'), function() {
						if($(this).attr('href').indexOf(location.href.split('/')[location.href.split('/').length-1]) != -1){
							$(this).addClass('active');
					};
					});
					
				}
			});
		</script>
	</body>
</html>
